import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;

public class test {

    // 定义日期格式
    public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    public static StringBuffer sb = new StringBuffer();

    public static void main(String[] args) {
        HashMap<Object, Object> doc = new HashMap<>();
        doc.put("timestamp", "14:20:00.008");
//        doc.put("timestamp", "2024-07-19 14:20:00.008");

//        doc.getField("timestamp").toString()
//        doc.addField("f2","123");


        String timestamp = doc.get("timestamp").toString();
        if (timestamp != null && timestamp.length() <= 12) {
            // 获取当前日期
            LocalDate today = LocalDate.now();
            // 将当前日期格式化为字符串
            String formattedDate = today.format(formatter);
            System.out.println(formattedDate);

            sb.append(formattedDate);
            sb.append(" ");
            sb.append(timestamp);
            String dateTime = sb.toString();

            System.out.println(dateTime);
            sb.setLength(0);
            System.out.println(sb.toString());

        }

    }
}
